<script setup lang='ts'>
import {ref} from 'vue'
import type {Ref} from 'vue'

const loginname: Ref<string> = ref('')
const password: Ref<string> = ref('')

function onSubmit(){
  // 做登录的数据提交
}

</script>
<template>
  <main class="box">
    <header class="header">
      <!-- <van-nav-bar
          title="登录"
          left-text="返回"
          left-arrow
          @click-left="$router.back()"
        /> -->

      <van-icon @click="$router.back()" class="left-icon" name="arrow-left" />
      登录
    </header>

    <div class="content">
      <van-form @submit="onSubmit">
        <van-cell-group inset>
          <van-field
            v-model="loginname"
            name="用户名"
            label="用户名"
            placeholder="用户名"
            :rules="[{ required: true, message: '请填写用户名' }]"
          />
          <van-field
            v-model="password"
            type="password"
            name="密码"
            label="密码"
            placeholder="密码"
            :rules="[{ required: true, message: '请填写密码' }]"
          />
        </van-cell-group>
        <div style="margin: 16px">
          <van-button round block color='#f66' native-type="submit">
            登录
          </van-button>
        </div>
        <div style="margin: 16px">
          <van-button @click="$router.push('/register')" round block type='success'>
            去注册
          </van-button>
        </div>
      </van-form>
    </div>
  </main>
</template>
<style scoped lang="scss">
.left-icon {
  float: left;
  line-height: 0.44rem;
  margin-left: 16px;
}
.content {
  padding-top: 30px;

  box-sizing: border-box;
}
</style>